import Vue from 'vue'
import Router from 'vue-router'
import axios from 'axios';
Vue.prototype.$axios = axios;

//新版本
import inquiry from '@/page/inquiry'
import symptoms from '@/page/symptoms'
import result from '@/page/result'
import wiki from '@/page/wiki'
import userProtocol from '@/page/userProtocol'
import records from '@/page/records'
import errorPage from '@/page/errorPage'


import PassNumber from '@/page/PassNumber'

Vue.use(Router)


const router = new Router({
	//mode: 'history',
  	routes: [
	  	{
	      path: '/',
	      name:'inquiry',
	      component:inquiry,	
	      
	   },
	   {
	      path: '/symptoms/:gender/:age',
	      name:'symptoms',
	      component:symptoms,	     
	   },
	   {
	      path: '/result/:id/:path',
	      name:'result',
	      component:result,	     
	   },
	   {
	      path: '/wiki/:id/:index',
	      name:'wiki',
	      component:wiki,	     
	   },
	   {
	      path: '/userProtocol',
	      name:'userProtocol',
	      component:userProtocol,	     
	   },
	   {
	      path: '/records',
	      name:'records',
	      component:records,	     
	   },
	   {
	      path: '/errorPage',
	      name:'errorPage',
	      component:errorPage,	     
	   },
	   {
	      path: '/PassNumber',
	      name:'PassNumber',
	      component:PassNumber,	     
	   },
  	]
})
//router.beforeEach((to, from, next) => {
// 		localStorage.removeItem('token');	
//	   let _search =window.location.href,
//		arr = _search.match("=(.)*#"),
//		token='';
//		if(arr){
//			var idx1 = arr[0].indexOf('=');
//			var idx2 = arr[0].indexOf('#');
//			token = arr[0].substring(idx1+1, idx2);
//		    localStorage.setItem('token',token);
//		}	
//		 if(!token && token==''){
//		 	console.log('进来没');
//		     let appId='wxc7817514dbdae0f9';
//		     let uriLocationHref=encodeURIComponent(window.location.href);
//		     let redirectUrl=encodeURIComponent('https://oauth2.rxthinking.com/wx-app/callback?app_id=wxc7817514dbdae0f9&redirect_uri=');
//		     let scope="snsapi_userinfo";
//		     let url="https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+redirectUrl+uriLocationHref+"&response_type=code&scope="+scope+"&state=STATE#wechat_redirect";
//		     window.location.replace(url);
//		 }else{
//		     next();
//		 }
//});
export default router;
